import React from 'react';
import style from './style.reviewCard.styl';
import styleContent from './style.reviewContent.styl';
import {Button,Link,Tooltip} from '../../../../ui-components';

class ReviewCard extends React.Component {
  constructor(props) {
    super(props);
    this.displayName = 'ReviewCard';
  }
  onClick = () => {
    this.props.onClick && this.props.onClick();
  }
  render() {
    const {
      item,
      deadLine,
    } = this.props;
    const nowStamp = new Date().getTime();
    const {
      revieweeUserProfile = {},
      isSubmitted,
      isCanceled,
      invitationDisplayType,
    } = item || {};
    return (
      <div className={style['box']}>
        <div className={style['img']}>
          <Link 
            className={style['settings-avatar']} 
            srcIcon="avatar"
            width="50"
            src={revieweeUserProfile.avatarUrl}/>
        </div>
        <div className={style['title']}>
          <h2>{revieweeUserProfile.fullName}</h2>
          <aside>{revieweeUserProfile.jobTitleName}</aside>
        </div>
        <div className={style['info']}>
          {
            invitationDisplayType === 2 || invitationDisplayType === 5 ?
              <Button className={style['button1']} label={'立即撰写'} onClick={this.onClick}/>
            :
            invitationDisplayType === 3 ?
              <Button className={style['button2']} label={'查看/修改'} onClick={this.onClick}/>
            :
            invitationDisplayType === 4 ?
              <Button className={style['button2']} label={'查看'} onClick={this.onClick}/>
            : 
            invitationDisplayType === 6 ?
              <div className={style['warning-info']}>已逾期</div>
            :  
            invitationDisplayType === 8 ?
              <Button className={style['button3']} label={'等待流程'}/>
            :
            invitationDisplayType === 1 ?
              <Button className={style['button3']} label={'等待自评'}/>
            : null  
          }
          {
            invitationDisplayType === 5 ?
            <Tooltip tip={'您已逾期，提交后不可修改'} arrow={'bottom'} className={style['tip']}>
              <div className={style['warning-info']}>已逾期</div>
            </Tooltip>
            : 
            invitationDisplayType === 7 || invitationDisplayType === 9 ?
              <div className={style['error-info']}>已取消</div>
            :null
          }
        </div>
      </div>
    );
  }
}

export default ReviewCard;
